home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
MacGames Sampler
/
PHT MacGames Bundle.iso
/
MacSource Folder
/
Samples from the CD
/
C and C++
/
Gnuplot 3.5 for Macintosh
/
SOURCES 3.5
/
term
/
regis.trm
< prev
next >
Wrap
Text File
|
1993-11-03
|
4KB
|
187 lines
/*
* $Id: regis.trm%v 3.38.2.122 1993/04/30 00:31:45 woo Exp woo $
*
*/
/* GNUPLOT - regis.trm */
/*
* Copyright (C) 1990 - 1993
*
* Permission to use, copy, and distribute this software and its
* documentation for any purpose with or without fee is hereby granted,
* provided that the above copyright notice appear in all copies and
* that both that copyright notice and this permission notice appear
* in supporting documentation.
*
* Permission to modify the software is granted, but not the right to
* distribute the modified code. Modifications are to be distributed
* as patches to released version.
*
* This software is provided "as is" without express or implied warranty.
*
* This file is included by ../term.c.
*
* This terminal driver supports:
* REGIS devices
*
* AUTHORS
* Colin Kelley, Thomas Williams
*
* send your comments or suggestions to (info-gnuplot@dartmouth.edu).
*
*/
#define REGISXMAX 800
#define REGISYMAX 440
#define REGISXLAST (REGISXMAX - 1)
#define REGISYLAST (REGISYMAX - 1)
#define REGISVCHAR 20
#define REGISHCHAR 9
#define REGISVTIC 8
#define REGISHTIC 6
#define TRUE 1
#define FALSE 0
static int REGIS16color=FALSE;
int REGISang = 0;
REGISinit()
{
fprintf(outfile,"\033[r\033[24;1H");
/* 1 2
1. reset scrolling region
2. locate cursor on bottom line
*/
}
/* thanks to calmasd!dko (Dan O'Neill) for adding S(E) for vt125s */
REGISgraphics()
{
fprintf(outfile,"\033[2J\033P1pS(C0)S(E)");
/* 1 2 3 4 5
1. clear screen
2. enter ReGIS graphics
3. turn off graphics diamond cursor
4. clear graphics screen
*/
(void) REGIStext_angle(0); /* select text size and angle */
}
REGIStext()
{
fprintf(outfile,"\033\\\033[24;1H");
/* 1 2
1. Leave ReGIS graphics mode
2. locate cursor on last line of screen
*/
}
REGISlinetype(linetype)
int linetype;
{
/* This will change color in order G,R,B,G-dot,R-dot,B-dot */
static int in_16_map[15+2] = {7,7,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15};
static int lt_16_map[15+2] = {1,4,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1};
static int in_map[9 + 2] = {2, 2, 3, 2, 1, 3, 2, 1, 3, 2, 1};
static int lt_map[9 + 2] = {1, 4, 1, 1, 1, 4, 4, 4, 6, 6, 6};
if(!REGIS16color)
{ if (linetype >= 9)
linetype %= 9;
fprintf(outfile, "W(I%d)\n", in_map[linetype + 2]);
fprintf(outfile, "W(P%d)\n", lt_map[linetype + 2]);
}
else
{ if(linetype >=15)
linetype %= 15;
fprintf(outfile, "W(I%d)\n", in_16_map[linetype + 2]);
fprintf(outfile, "W(P%d)\n", lt_16_map[linetype + 2]);
}
}
/*
** The \n was added in the functions below (and above) in order to not cause
** a buffer overflow in devices that can't deal with long line lengths.
** The DEC vt-340 doesn't need this, but Reflection 4, a vt-340 emulator
** for PC's under MS-DOS and Microsoft Windows does need it.
** Also needed for DECterm, a vt-340 emulator for use with Motif 1.0
** on Open/VMS.
** NGB 9/13/93
*/
REGISmove(x,y)
int x,y;
{
fprintf(outfile,"P[%d,%d]\n",x,REGISYLAST-y,x,REGISYLAST-y);
}
REGISvector(x,y)
int x,y;
{
fprintf(outfile,"v[]v[%d,%d]\n",x,REGISYLAST - y);
/* the initial v[] is needed to get the first pixel plotted */
}
/* put_text and text_angle by rjl */
REGISput_text(x,y,str)
int x, y;
char *str;
{
if (REGISang==1)
REGISmove(x-REGISVCHAR/2-1,y);
else
REGISmove(x,y+REGISVCHAR/2-1);
(void) putc('T',outfile); (void) putc('\'',outfile);
while (*str) {
(void) putc(*str,outfile);
if (*str == '\'')
(void) putc('\'',outfile); /* send out another one */
str++;
}
(void) putc('\'',outfile);
(void) putc('\n',outfile);
}
int REGIStext_angle(ang)
int ang;
{
REGISang = ang;
if (ang == 1)
fputs("T(D90,S1)\n",outfile);
else
fputs("T(D0,S1)\n",outfile);
return TRUE;
}
REGISreset()
{
fprintf(outfile,"\033[2J\033[24;1H");
}
REGISoptions()
{ int i=0;
struct value a;
extern struct value *const_express();
extern double real();
if(!END_OF_COMMAND)
{ i=(int)real(const_express(&a));
}
REGIS16color= (i==16);
sprintf(term_options,"%s",REGIS16color?"16":"4");
}